/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Core.impl.EquipmentImpl;

import EA_Model.IEC61970.Wires.CompositeSwitch;
import EA_Model.IEC61970.Wires.CompositeSwitchType;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Composite Switch</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.CompositeSwitchImpl#getCompositeSwitchType <em>Composite Switch Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CompositeSwitchImpl extends EquipmentImpl implements CompositeSwitch {
	/**
	 * The cached value of the '{@link #getCompositeSwitchType() <em>Composite Switch Type</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompositeSwitchType()
	 * @generated
	 * @ordered
	 */
	protected CompositeSwitchType compositeSwitchType;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CompositeSwitchImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.COMPOSITE_SWITCH;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CompositeSwitchType getCompositeSwitchType() {
		if (compositeSwitchType != null && compositeSwitchType.eIsProxy()) {
			InternalEObject oldCompositeSwitchType = (InternalEObject)compositeSwitchType;
			compositeSwitchType = (CompositeSwitchType)eResolveProxy(oldCompositeSwitchType);
			if (compositeSwitchType != oldCompositeSwitchType) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE, oldCompositeSwitchType, compositeSwitchType));
			}
		}
		return compositeSwitchType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CompositeSwitchType basicGetCompositeSwitchType() {
		return compositeSwitchType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCompositeSwitchType(CompositeSwitchType newCompositeSwitchType) {
		CompositeSwitchType oldCompositeSwitchType = compositeSwitchType;
		compositeSwitchType = newCompositeSwitchType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE, oldCompositeSwitchType, compositeSwitchType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE:
				if (resolve) return getCompositeSwitchType();
				return basicGetCompositeSwitchType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE:
				setCompositeSwitchType((CompositeSwitchType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE:
				setCompositeSwitchType((CompositeSwitchType)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.COMPOSITE_SWITCH__COMPOSITE_SWITCH_TYPE:
				return compositeSwitchType != null;
		}
		return super.eIsSet(featureID);
	}

} //CompositeSwitchImpl
